package main

import (
	"flag"
	"fmt"
	"os"
	"path/filepath"
	"tinyc/code/tinyc/root"
)

func parentRun() {
	var imageDir string

	fs := flag.NewFlagSet("run", flag.ExitOnError)
	fs.StringVar(&imageDir, "i", "", "image dir")
	assert(fs.Parse(os.Args[2:]))

	if fs.NArg() <= 0 {
		fmt.Println("Missing command")
		os.Exit(1)
	}

	var err error
	imageDir, err = filepath.Abs(imageDir)
	assert(err)

	c := root.New(imageDir, fs.Args())
	assert(c.Run())
}
